﻿@model Domain.Model.News
@{
    ViewBag.Link = "/info/index";
}

@section Script
{
    <link href="~/Content/validBox/validBox.css" rel="stylesheet" />
    <script src="~/Content/validBox/validBox.js"></script>
    <link href="~/Content/window/window.css" rel="stylesheet" />
    <script src="~/Content/window/window.js"></script>
    }

<div>
    <ul class="breadcrumb">
        <li><a href="/info/index">信息管理</a> <span class="divider">/</span></li>
        <li class="active">新闻管理</li>
    </ul>
</div>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    
    <div class="control-group">
        <label class="control-label" for="Name">标题</label>
        <div class="controls">
            @Html.TextBoxFor(item => item.Title, Html.ValidFor(item => item.Title))
        </div>
    </div>

    <p>
        <input type="button" value="保存" class="btn btn-info"  onclick="save()"/>
        <input type="button" value="取消" class="btn btn-info" onclick="history.go(-1); return false;" />
    </p>
 
        
    @Html.HiddenFor(i => i.ID)
}

<script type="text/javascript">
    function save() {
        $("form").validBox(function (r) {
            if (r == false)
                return;

            $.post("/info/newscreate",
                $("form").serialize(),
                function (data) {
                    if (data.state) {
                        location = data.value;
                    }
                });
        });
    }

</script>
